home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / ada / gnat1792.zip / gnat179b / t-adainc / s-tatise.ads < prev    next >
Text File  |  1994-05-19  |  4KB  |  90 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                 GNU ADA RUNTIME LIBRARY (GNARL) COMPONENTS               --
  4. --                                                                          --
  5. --             S Y S T E M . T A S K _ T I M E R _ S E R V I C E            --
  6. --                                                                          --
  7. --                                  S p e c                                 --
  8. --                                                                          --
  9. --                             $Revision: 1.4 $                             --
  10. --                                                                          --
  11. --           Copyright (c) 1991,1992,1993, FSU, All Rights Reserved         --
  12. --                                                                          --
  13. --  GNARL is free software; you can redistribute it and/or modify it  under --
  14. --  terms  of  the  GNU  Library General Public License as published by the --
  15. --  Free Software Foundation; either version 2, or  (at  your  option)  any --
  16. --  later  version.   GNARL is distributed in the hope that it will be use- --
  17. --  ful, but but WITHOUT ANY WARRANTY; without even the implied warranty of --
  18. --  MERCHANTABILITY  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Gen- --
  19. --  eral Library Public License for more details.  You should have received --
  20. --  a  copy of the GNU Library General Public License along with GNARL; see --
  21. --  file COPYING. If not, write to the Free Software Foundation,  675  Mass --
  22. --  Ave, Cambridge, MA 02139, USA.                                          --
  23. --                                                                          --
  24. ------------------------------------------------------------------------------
  25.  
  26. --  Server to manage delays. Written in terms of System.Real_Time.Time
  27. --  and System.Task_Clock.Time.
  28.  
  29. with Ada.Calendar;
  30. with System.Real_Time;
  31. with System.Task_Clock;
  32. with System.Tasking;
  33.  
  34. package System.Task_Timer_Service is
  35.  
  36. --  Implementing a proteced type using a single package
  37.  
  38.    package Signal_Object is
  39.  
  40.       type O_Type is record
  41.          Object : Tasking.Protection (Num_Entries => 1);
  42.          Open   : Boolean := False;
  43.       end record;
  44.  
  45.       procedure Signal (PO : in out O_Type);
  46.  
  47. --  9X code : function Wait_Count return integer;  ???
  48.       procedure Wait_Count (PO : in out O_Type; W : out Integer);
  49.       --  This is a general purpose function.
  50.       --  This can not be implemented using function in Ada83 because
  51.       --  passing object has to be 'in out' mode (for read_lock in the
  52.       --  body of the function). Therefore we use a procedure instead.
  53.  
  54.       procedure Service_Entries
  55.         (PO : in out O_Type;
  56.          Pending_Serviced : out Boolean);
  57.  
  58.    end Signal_Object;
  59.  
  60.    package Timer is
  61.  
  62.       Object : Tasking.Protection (Num_Entries => 4);
  63.  
  64.       --  Relative Delays
  65.  
  66.       type Time_Span_Params is record
  67.          Param : Real_Time.Time_Span;
  68.       end record;
  69.  
  70.       type Duration_Params is record
  71.          Param : Duration;
  72.       end record;
  73.  
  74.       --  Absolute Delays
  75.       type Real_Time_Time_Params is record
  76.          Param : Real_Time.Time;
  77.       end record;
  78.  
  79.       type Calendar_Time_Params is record
  80.          Param : Ada.Calendar.Time;
  81.       end record;
  82.  
  83.       procedure Service (T : out Task_Clock.Stimespec);
  84.  
  85.       procedure Service_Entries (Pending_Serviced : out Boolean);
  86.  
  87.    end Timer;
  88.  
  89. end System.Task_Timer_Service;
  90.